#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>
#include<string.h>


//unsigned int my_strlen(const char *str)
//{
//	assert(str != NULL);
//	unsigned int count = 0;
//	while (*str++)
//	{
//		count++;
//	}
//	return count;
//}
//
//int main()
//{
//	char arr[] = "hello";
//	printf("%d\n", my_strlen(arr));
//}



//int main()
//{
//	int a = 0, b = 0;
//	scanf("%d %d", &a, &b);
//	int i = 0;
//	while (((a * ++i) % b) != 0)
//	{
//	}
//	printf("%d\n",a*i);
//
//}




void reverse(char* left, char* right)
{
	while (left < right)
	{
		char tmp = 0;
		tmp = *left;
		*(left++) = *right;
		*(right--) = tmp;
	}
}

int main()
{
	char arr[100] = { 0 };
	gets(arr);
	int len = strlen(arr);
	reverse(arr,arr+len-1);
	char* start = arr;
	while (*start)
	{
		char* end = start;
		while (*end != '\0' && *end != ' ')
		{
			end++;
		}
		reverse(start, end - 1);
		if (*end == ' ')
			start = end + 1;
		else
			start = end;
	}
	
	printf("%s\n", arr);
}